#include <stdio.h>

int numOfSubarrays(int* arr, int arrSize, int k, int threshold) {
    long sum=0;
    int count=0;
    for( int i=0; i < arrSize; i++ ){
        sum+=arr[i];
        if( i < k-1 ){
            continue;
        }
        if( sum >= k*threshold )
            count++;
        sum-=arr[ i-k+1 ];
    }
    return count;
}

int main(){
    int arr[]={11,13,17,23,29,31,7,5,2,3};
    printf("%d\n",numOfSubarrays(arr,sizeof(arr)/sizeof(int),3,5));
    return 0;
}
